/**
 * Author(s): xuming.Wong <xuming.Wong@gmail.com>
 */

#ifndef __PQ_MeshObject_H__
#define __PQ_MeshObject_H__

#include "GameObject.h"
#include "MeshComponent.h"

namespace PQEngine
{
	/*Enity object is a game object that attach one entity component to it.
	*/
	class MeshObject
		: public GameObject
	{
	public:
		friend SceneObject;
	protected:
		MeshObject(SceneObject* scene,Ogre::String meshName);
	public:
		inline MeshComponent* getMeshComponent()
		{
			return _component;
		}

		Ogre::Entity* getEntity();

		/** Sets the animation blending mode this skeleton will use. */
		virtual void setBlendMode(Ogre::SkeletonAnimationBlendMode state);

		/*Add OGRE skeleton.
		@param name The name of skeleton file.
		@param name The group name of skeleton file.
		*/
		void addSkeletonAnim(Ogre::String &name);

		 /** Rotate the node around an arbitrary axis.
        */
		virtual void rotate(const Ogre::Vector3& axis, const Ogre::Radian& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);

		/** Scales the node, combining it's current scale with the passed in scaling factor. 
        @remarks
            This method applies an extra scaling factor to the node's existing scale, (unlike setScale
            which overwrites it) combining it's current scale with the new one. E.g. calling this 
            method twice with Vector3(2,2,2) would have the same effect as setScale(Vector3(4,4,4)) if
            the existing scale was 1.
        @par
            Note that like rotations, scalings are oriented around the node's origin.
        */
		virtual void scale(const Ogre::Vector3& scale);

	private:
		MeshComponent* _component;//easy access already in game object components.
		Ogre::Entity* _entity;
		Ogre::MeshPtr _mesh;

		Ogre::String _meshName;
		Ogre::String _meshGroup;


	};
}
#endif
